set(CLIPBOARD_SOURCES clipboard.cpp)
if (WAYLAND_FOUND)
set(CLIPBOARD_SOURCES ${CLIPBOARD_SOURCES} waylandclipboard.cpp)
endif()
add_library(clipboard MODULE ${CLIPBOARD_SOURCES})

target_link_libraries(clipboard Fcitx5::Core)
if (ENABLE_X11)
    target_link_libraries(clipboard Fcitx5::Module::XCB XCB::XCB)
endif()
if (WAYLAND_FOUND)
    target_link_libraries(clipboard Fcitx5::Module::Wayland Fcitx5::Wayland::WLRDataControl Pthread::Pthread)
endif()
install(TARGETS clipboard DESTINATION "${FCITX_INSTALL_ADDONDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/clipboard.conf" DESTINATION "${FCITX_INSTALL_PKGDATADIR}/addon"
        COMPONENT config)
configure_file(clipboard.conf.in.in clipboard.conf.in @ONLY)
fcitx5_translate_desktop_file(${CMAKE_CURRENT_BINARY_DIR}/clipboard.conf.in clipboard.conf)
fcitx5_export_module(Clipboard TARGET clipboard BUILD_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" HEADERS clipboard_public.h INSTALL)

